package com.Lyy.Dao;

import com.Lyy.Entity.Student;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;

import java.util.List;
@Component
public interface StudentMapper {
    @Select("select * from book2.student")
    List<Student> SelectStudentAll();

    @Select("select * from book2.student where studentId=#{studentId}")
    Student SelectStudentById(int id);

    @Select("select * from book2.student where studentName like '%${studentName}%'")
    List<Student> SelectStudentByName(String studentName);

    @Update("update book2.student set studentName = #{studentName}, classname = #{classname},classTeacher=#{classTeacher} where studentId = #{studentId}")
    int UpdateStudent(Student student);

    @Delete("delete from book2.student where studentId =#{studentId}")
    int DeleteStudentById(int studentId);
    @Insert("insert into book2.student (studentName, classname, classTeacher) VALUES (#{studentName}, #{classname}, #{classTeacher})")
    int InsertStudent(Student student);

}
